import { EntityObjectFactory } from './../entityObjectFactory';
var EntityObject = EntityObjectFactory.GetEntityObjectType();

interface CartItemExtend {
    categories: any;
}

interface KitchenOrderProducer {
    id: string;
    name: string;
}
/**
 * 购物车
 * @interface KDSCartItem
 */
export interface KitchenOrderItem {
    id: string;
    qty: number;
    inventoryCode: string;
    inventoryId: string;
    inventoryName: string;
    modifiers?: Modifier[];
    categories?: Category[];
    beginTime?: number;//开始制作时间
    finishTime?: number;//单项完成时间
    user?: { id: string; name: string }
    description?: string;
    //最后一次催菜时间
    remindTime?: number;
    //总催菜次数
    remindCount?: number;
    //退菜数量
    refundQty?: number;
    extended?: CartItemExtend;
    producerId?: string;
    producer?: KitchenOrderProducer;
    deliverTime?: number;//出品时间 +
    stalls?: string[];
    /**
     * 已出品的数量
     * 
     * @type {number}
     * @memberOf KitchenOrder
     */
    expediteQty?: number;
    pickup?: "" | "waiting" | "pickup";
    type?:"" | "closed" | "canceled"
}

/**
 * 
 * @interface Modifier
 */
interface Modifier {
    name: string;
    options: [any];
}

interface OrderExtended {
    table:{
        id:string;
        name:string;
        zone:{
            id:string;
            name:string;
        }
    }
}

interface Category {
    id: string;
    name: string;
    parent: Category;
}

export class KitchenOrder extends EntityObject<KitchenOrder>{
    constructor(ctx?) { super(ctx); }
    id: string = null;
    orderId: string = null;
    seriaNo: string = null;
    items: KitchenOrderItem[] = null;
    description?: string = null;
    extended: OrderExtended = null;
    customerIdentity: string = null;
    terminalId: string = null;
    //下单时间
    receiveTime: number = null;
    //完成时间
    finishTime: number = null;
    createTime: number = null;
    beginTime: number = null;
    stall: string[] = null;
    terminalName: string = null;
    type: "pre-order" | "pre-order-refund" | "pickup-order" | "remind-order";
    originalOrderIds: Array<string>;
    toString(): string { return "KitchenOrder"; }
}